home *** CD-ROM | disk | FTP | other *** search
/ Technotools / Technotools (Chestnut CD-ROM)(1993).ISO / lang_oth / lck21b / error.lsp next >
Text File  |  1988-11-18  |  1KB  |  43 lines

  1. ; Stan H. Bimson 73507,3475 - CAD/Engineering Services - 15 June 1987
  2. ; Rte 2 Box 293 Forest Harbor Drive  -  Hendersonville, TN 37075-9802
  3. ;
  4. ; Reset normal variables at the end of a program run.
  5. ; (GC) is an undocumented function.
  6.  
  7. (DeFun End ()                 ; Syntax:   (END)
  8.   (COMMAND "OSnap" "None")
  9.   (SetVar "Aperture" 8)
  10.   (SetVar "Blipmode" 1)
  11.   (GC)
  12.   (Princ)
  13. )
  14.  
  15. ; To Quit a program at some place inside the program
  16. ; Syntax in a program:  (If (NULL Entered) (Cmdp))
  17. ; Quit is an undocumented AutoLISP function
  18.  
  19. (DeFun Cmdp () (Quit) )
  20.  
  21. ; To stop screen display of LISP programs when program is
  22. ; aborted/cancelled/^C/or fails on its' own internally the
  23. ; AutoLISP function *ERROR* must be redefined. On some
  24. ; abnormal program ending AutoLISP will pass a string with
  25. ; the appropriate error message, this string can be handled
  26. ; as shown below. If I abort the program in some manner I
  27. ; don't what the LISP code or the error message but if it
  28. ; fails for another error I at least what the error message
  29. ; to help find the program error.
  30.  
  31. (DeFun *ERROR* (St)
  32.   (Cond
  33.     ((OR (= St "Function cancelled")
  34.          (= St "console break")
  35.          (= St "quit / exit abort")) )
  36.     ((Princ St))
  37.   )
  38.   (End); clean things up
  39. )
  40.  
  41. ; Add these function to your ACAD.LSP file or type them into
  42. ; a file named ACAD.LSP and in your AutoCAD subdirectory.
  43.